package com.oe.web;


import com.oe.pojo.ResumePojo;
import com.oe.service.IResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Optional;

@Controller
public class ResumeController {

    @Autowired
    IResumeService resumeService;

    @RequestMapping("/resume/index")
    public String index(){

        return "resumePage";
    }


    @RequestMapping("/resume/page")
    @ResponseBody
    public List<ResumePojo> page(){
        List<ResumePojo> all = resumeService.queryAll();
        return all;
    }

    @RequestMapping("/resume/delete")
    @ResponseBody
    public String delete(Long id){
       // resumeDao.deleteById(id);
      return "true";
    }

    @RequestMapping("/resume/insertOrupdate")
    @ResponseBody
    public String update(ResumePojo resume){
        resumeService.insertOrUpdate(resume);
        return "true";
    }


  /*  public Resume queryOne(Long id){
        Optional<Resume> byId = resumeDao.findById(id);
        return byId.get();
    }*/
}
